package com.wxzl.community.common.utils.ext

import android.graphics.drawable.Drawable
import android.widget.ImageView
import com.bumptech.glide.Glide
import com.bumptech.glide.Priority
import com.bumptech.glide.load.engine.DiskCacheStrategy
import com.bumptech.glide.load.resource.drawable.DrawableTransitionOptions
import com.bumptech.glide.request.RequestOptions
import com.bumptech.glide.request.target.CustomTarget
import com.bumptech.glide.request.transition.DrawableCrossFadeFactory
import com.bumptech.glide.request.transition.Transition
import com.wxzl.community.common.R
import jp.wasabeef.glide.transformations.RoundedCornersTransformation

fun ImageView.setPath(path: String) {

    Glide.with(this.context).load(path)
        //缓存策略,跳过内存缓存【此处应该设置为false，否则列表刷新时会闪一下】
        .skipMemoryCache(false)
        //缓存策略,硬盘缓存-仅仅缓存最终的图像，即降低分辨率后的（或者是转换后的）
        .diskCacheStrategy(DiskCacheStrategy.ALL)
        //设置图片加载的优先级
        .priority(Priority.HIGH).thumbnail(0.1f)
        .placeholder(R.mipmap.placeholder)
        .thumbnail(0.1f)
        .error(R.mipmap.img404)
        .into(this)


}








